<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
/**
 * 模型
 */
class Web_message_model extends CI_Model {
	public function __construct() {
		parent::__construct ();
	}
	
	/**
	 * 查询所有
	 */
	public function web_message() {
		$query = $this->db->get ( 'pc_ddth_web_message' );
		return $query->row_array ();
	}
	
	/**
	 * 按id更新用户信息
	 */
	public function update_web_message($id,$logo_path) {
		if (strlen ( $_POST ['logo_path'] ) < 2) {
			$data = array (
					'title' => $_POST ['title'],
					'name' => $_POST ['name'],
					'keyword' => $_POST ['keyword'],
					'description' => $_POST ['description'],
					'message' => $_POST ['message'],
					'filing' => $_POST ['filing'],
					'address' => $_POST ['address'] 
			);
		} else {
			$data = array (
					'logo_path' => $logo_path,
					'title' => $_POST ['title'],
					'name' => $_POST ['name'],
					'keyword' => $_POST ['keyword'],
					'description' => $_POST ['description'],
					'message' => $_POST ['message'],
					'filing' => $_POST ['filing'],
					'address' => $_POST ['address'] 
			);
		}
		
		$result = $this->db->update ( 'pc_ddth_web_message', $data, array (
				'id' => $id 
		) );
		
		return $result;
	}
}